<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <p>{{num}}---<button @click="num++">点击</button> </p>
        <aaa :count="num"></aaa>
    </div>
</body>
<script>
    // 需求: 想把num -> 传递给aaa->bbb->comp-test
    Vue.component("comp-test", {
        props: {
            count: Number
        },
        data() {
            return {

            }
        },
        template: `<div >这是comp-test组件:{{count}}</div>`,
    })


    Vue.component("bbb", {
        props: {
            count: Number
        },
        data() {
            return {}
        },
        template: `
            <div>
                <h4>这是bbb组件:{{count}}</h4>
                <comp-test :count='count'></comp-test>
            </div>
        `
    })
    Vue.component("aaa", {
        props: {
            count: Number
        },
        data() {
            return {}
        },
        template: `<div>
            <h3>这是aaaa组件:{{count}}</h3>
            <bbb :count='count'></bbb>
        </div>`
    })




    var vm = new Vue({
        el: "#app",
        data: {
            num: 1
        }
    })



</script>

</html>